<template>
  <Viewer :router="viewerRouter"></Viewer>
</template>

<script setup>
import { defineAsyncComponent } from 'vue'
import { useInfiniteForyou } from '@/compositions/request/infiniteForyou'
import { useDesktopViewerRouter } from '@/compositions/viewer/router/desktopViewerRouter'

const Viewer = defineAsyncComponent(() => import('@/components/viewer/Viewer.vue'))

const props = defineProps({
  id: { type: String },
  shareAff: { type: String },
})

const emits = defineEmits(['sharedFeed'])

const viewerRouter = useDesktopViewerRouter('desktop-share-media')
const { setFromMainViewer } = viewerRouter

setFromMainViewer({
  foryou: useInfiniteForyou({
    params: { mv_id: props.id, share_aff: props.shareAff },
    onInit: (dataList) => {
      emits('sharedFeed', dataList[0])
    },
  }),
})
</script>
